package com.walt.zhong.sample


import android.os.Handler
import android.os.Looper
import android.util.Log
import android.widget.Toast
import com.google.auto.service.AutoService
import com.ui.zhong.webview.ACallback
import com.ui.zhong.webview.command.Command
import com.walt.zhong.base.BaseApplication


@AutoService(Command::class)
class CommandShowToast : Command {

    override fun name(): String = "showToast"

    override fun execute(parameters: Map<*, *>, callback: ACallback?) {
        Log.d("zhongxj", "execute===>" + parameters["message"]
            .toString()
        )
        Handler(Looper.getMainLooper()).post {
            Toast.makeText(BaseApplication.sApplication, parameters["message"]
                .toString(), Toast.LENGTH_SHORT).show()
        }
    }

}